package com.ht.temp.mapper;

import com.ht.temp.entity.OnLineTemperature;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author mayke_zhou
 * @since 2018-12-19
 */
@Repository
public interface OnLineTemperatureMapper extends BaseMapper<OnLineTemperature> {

    //查询温度表某一分钟之前一分钟的数据
    List<OnLineTemperature> selectMinReportByMin(@Param("nowTime") String nowTime, @Param("afterTime") String afterTime,@Param("deviceId") Integer deviceId);

    //计算获取温度表某一分钟之前一分钟的平均数据
    OnLineTemperature selectMinReportByMinAve(@Param("nowTime") String nowTime, @Param("afterTime") String afterTime,@Param("deviceId") Integer deviceId);

    //查找最近的十条数据
    List<OnLineTemperature> selectByOnLineTemperature(OnLineTemperature onLineTemperature);

    //查找最近的24小时的所有数据
    List<OnLineTemperature> selectRecentlyTemperature(OnLineTemperature onLineTemperature);
    //删除
    int deleteByPrimaryKey(Integer temId);

    //插入
    int insertSelectiveOnLineTemperature(OnLineTemperature record);


    List<OnLineTemperature> selectPastrecords(@Param("deviceId") Integer deviceId, @Param("searchTime") String searchTime);

    //查找
    OnLineTemperature selectByPrimaryKey(Integer temId);
}
